import QtQuick 2.0
import QtWebView 1.1
import HBaiduLogin 1.0

Rectangle {
    width: 1024
    height: 768

    BaiduLogin {
        id:cpp_lg
    }
    WebView {
        id:webview
        anchors.fill: parent
        onLoadingChanged: function(loadRequest) {
            if (loadRequest.errorString)
                console.error(loadRequest.errorString);
            console.log("onLoadingChanged", webview.url);
            if(cpp_lg.loginSucess(webview.url)){
                loginui.visible = false;
                fileui.visible = true;
                //console.log("true")
            }else{
                //console.log("false");
            }
        }
    }

    function showLoginWeb()
    {
        webview.url = "https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id=" + cpp_lg.client_id + "&redirect_uri=oob&scope=basic,netdisk&login_type=sms";
    }
}



